<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="box">
        <input type="text" id="input" />
        <span id="span"></span>
    </div>
    <div id="box1">
        <input type="text" id="input" />
        <span id="span"></span>
    </div>
    <div id="box2">
        <input type="text" id="input" />
        <span id="span"></span>
    </div>
    <script>
        window.$Property = (function(doc) {
            function Property(id) {
                this.obox = doc.getElementById(id);
                this.oInput = this.obox.querySelector('#input');
                this.oSpan = this.obox.querySelector('#span');
                this.data = {
                    a: 0
                };
                this.eventObj = {
                    get() {
                        return value;
                    },
                    set: (newValue) => {
                        this.render(newValue)
                        value = newValue;
                    }
                }
                this.init()
            }
            Property.prototype.init = function() {
                this.obersver();
                this.eventBind()
            }
            Property.prototype.obersver = function() {
                let value;
                Object.defineProperty(this.data, 'a', this.eventObj)
            }
            Property.prototype.eventBind = function() {
                this.oInput.addEventListener('input', this.handleInput.bind(this), false);
            }
            Property.prototype.handleInput = function(e) {
                this.data.a = e.target.value;
            }
            Property.prototype.render = function(newValue) {
                this.oSpan.innerText = newValue;
            }
            return Property;
        })(document);
    </script>
    <script>
        new $Property('box');
        new $Property('box1');
        new $Property('box2');
    </script>
</body>

</html>